var dom001 =
  '<div id="p0y1" class="bx-nav height-light-area">\
        <ul id="p0y1ul" class="nav-list1">\
        </ul>\
    </div>\
    <div id="p0y2">\
        <div id="AREA001">\
        <div id="AREA001x0" class="left-arrow"><img src="/custom-templates/images/home/xiangzuo.png"></div>\
        <div id="AREA001x1">\
            <div id="AREA001x1x0">\
                <div id="AREA001x1x0y0" class="ver-box-style" tabindex="-1">\
                </div>\
                <div id="AREA001x1x0y1">\
                    <ul id="AREA001x1x0y1ul">\
                    </ul>\
                </div>\
            </div>\
            <div id="AREA001x1x1" class="ver-box-style" tabindex="-1">\
            </div>\
            <div id="AREA001x1x2">\
                <ul id="AREA001x1x2ul">\
                </ul>\
            </div>\
        </div>\
        <div id="AREA001x2" class="right-arrow"><img src="/custom-templates/images/home/xiangyou.png"></div>\
        </div>\
    </div>';

var pageData001 = {
  data: {
    x0y0: {
      type: "tag",
      data: [
        {
          img: "/custom-templates/images/defaultImg2.png",
          title: "占位文字",
          data_detailId: 1
        }
      ]
    },
    x0y1: {
      type: "ul",
      data: [
        {
          img: "/custom-templates/images/defaultImg2.png",
          title: "占位文字",
          data_detailId: 1
        },
        {
          img: "/custom-templates/images/defaultImg2.png",
          title: "占位文字",
          data_detailId: 2
        }
      ]
    },
    x1: {
      type: "tag",
      data: [
        {
          img: "/custom-templates/images/defaultImg2.png",
          title: "占位文字",
          data_detailId: 1
        }
      ]
    },
    x2: {
      type: "ul",
      data: [
        {
          img: "/custom-templates/images/defaultImg2.png",
          title: "占位文字",
          data_detailId: 1
        },
        {
          img: "/custom-templates/images/defaultImg2.png",
          title: "占位文字",
          data_detailId: 2
        },
        {
          img: "/custom-templates/images/defaultImg2.png",
          title: "占位文字",
          data_detailId: 3
        },
        {
          img: "/custom-templates/images/defaultImg2.png",
          title: "占位文字",
          data_detailId: 4
        }
      ]
    }
  }
};

//生成推荐位
function fillNowArea(data, id) {
  for (var ele in data) {
    var eleData = data[ele].data;
    if (data[ele].type == "tag") {
      $.each(eleData, function(index, eleTag) {
        $("#AREA" + id + "x1" + ele).html(
          '<button class="btn btn-primary uploadPicBtn" type="submit">上传图片</button><img src="' +
            eleTag.img +
            '"><p>' +
            eleTag.title +
            "</p>"
        );
      });
    } else if (data[ele].type == "ul") {
      $.each(eleData, function(index, eleLi) {
        $("#AREA" + id + "x1" + ele + "ul").append(
          '<li class="ver-box-style" data-detailId=' +
            eleLi.data_detailId +
            '><button class="btn btn-primary uploadPicBtn" type="submit">上传图片</button><img src="' +
            eleLi.img +
            '"><p>' +
            eleLi.title +
            "</p></li>"
        );
      });
    }
  }
}


window.initArea001 = function() {
  fillNowArea(pageData001.data, "001");

};

var divs = ["AREA001x1x0y0", "AREA001x1x0y1", "AREA001x1x1", "AREA001x1x2"];
window.OPTIONS = {
  AREA001x1x0y0: {
    options_url: "/videos", // 数据来源
    mapping: {
      // 数据映射
    },
    count: 1, // 资源个数
    area: "x0y0",
    areaType: "area",
    areaId: "001"
  },
  AREA001x1x0y1: {
    options_url: "/videos", // 数据来源
    count: 2, // 资源个数
    area: "x0y1",
    areaType: "area",
    areaId: "001",
    mapping: {
      // 数据映射
    }
  },
  AREA001x1x1: {
    options_url: "/videos", // 数据来源
    count: 1, // 资源个数
    area: "x1",
    areaType: "area",
    areaId: "001",
    mapping: {
      // 数据映射
    }
  },
  AREA001x1x2: {
    options_url: "/videos", // 数据来源
    count: 4, // 资源个数
    area: "x2",
    areaType: "area",
    areaId: "001",
    mapping: {
      // 数据映射
    }
  }
};
$("#custom-template-wrap").html(dom001);
addHeadList("首页")
initArea001();